import 'package:get/get.dart';

import '../modules/compose_demo/bindings/compose_demo_binding.dart';
import '../modules/compose_demo/modules/bottom_sheet_demo/bindings/bottom_sheet_demo_binding.dart';
import '../modules/compose_demo/modules/bottom_sheet_demo/views/bottom_sheet_demo_view.dart';
import '../modules/compose_demo/modules/dialog_demo/bindings/dialog_demo_binding.dart';
import '../modules/compose_demo/modules/dialog_demo/views/dialog_demo_view.dart';
import '../modules/compose_demo/modules/snackbar_demo/bindings/snackbar_demo_binding.dart';
import '../modules/compose_demo/modules/snackbar_demo/views/snackbar_demo_view.dart';
import '../modules/compose_demo/views/compose_demo_view.dart';
import '../modules/deep_link_demo/bindings/deep_link_demo_binding.dart';
import '../modules/deep_link_demo/views/deep_link_demo_view.dart';
import '../modules/get_utils_demo/bindings/get_utils_demo_binding.dart';
import '../modules/get_utils_demo/views/get_utils_demo_view.dart';
import '../modules/get_view_and_get_widget/bindings/get_view_and_get_widget_binding.dart';
import '../modules/get_view_and_get_widget/modules/getx_view_page/bindings/getx_view_page_binding.dart';
import '../modules/get_view_and_get_widget/modules/getx_view_page/views/getx_view_page_view.dart';
import '../modules/get_view_and_get_widget/modules/getx_widget_page/bindings/getx_widget_page_binding.dart';
import '../modules/get_view_and_get_widget/modules/getx_widget_page/views/getx_widget_page_view.dart';
import '../modules/get_view_and_get_widget/views/get_view_and_get_widget_view.dart';
import '../modules/getx_controller_demo/bindings/getx_controller_demo_binding.dart';
import '../modules/getx_controller_demo/modules/getconnect_page/bindings/getconnect_page_binding.dart';
import '../modules/getx_controller_demo/modules/getconnect_page/views/getconnect_page_view.dart';
import '../modules/getx_controller_demo/modules/getx_controller_page/bindings/getx_controller_page_binding.dart';
import '../modules/getx_controller_demo/modules/getx_controller_page/views/getx_controller_page_view.dart';
import '../modules/getx_controller_demo/modules/statemixin_page/bindings/statemixin_page_binding.dart';
import '../modules/getx_controller_demo/modules/statemixin_page/views/statemixin_page_view.dart';
import '../modules/getx_controller_demo/modules/super_controller_page/bindings/super_controller_page_binding.dart';
import '../modules/getx_controller_demo/modules/super_controller_page/views/super_controller_page_view.dart';
import '../modules/getx_controller_demo/views/getx_controller_demo_view.dart';
import '../modules/index/bindings/index_binding.dart';
import '../modules/index/views/index_view.dart';
import '../modules/language_demo/bindings/language_demo_binding.dart';
import '../modules/language_demo/views/language_demo_view.dart';
import '../modules/navigation_demo/bindings/navigation_demo_binding.dart';
import '../modules/navigation_demo/modules/navigation1/bindings/navigation1_binding.dart';
import '../modules/navigation_demo/modules/navigation1/views/navigation1_view.dart';
import '../modules/navigation_demo/modules/navigation2/bindings/navigation2_binding.dart';
import '../modules/navigation_demo/modules/navigation2/views/navigation2_view.dart';
import '../modules/navigation_demo/modules/not_found/bindings/not_found_binding.dart';
import '../modules/navigation_demo/modules/not_found/views/not_found_view.dart';
import '../modules/navigation_demo/modules/test_middle_ware/bindings/test_middle_ware_binding.dart';
import '../modules/navigation_demo/modules/test_middle_ware/views/test_middle_ware_view.dart';
import '../modules/navigation_demo/modules/test_middle_ware1/bindings/test_middle_ware1_binding.dart';
import '../modules/navigation_demo/modules/test_middle_ware1/views/test_middle_ware1_view.dart';
import '../modules/navigation_demo/nested_navigation/bindings/nested_navigation_binding.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation1/bindings/nested_navigation1_binding.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation1/views/nested_navigation1_view.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation2/bindings/nested_navigation2_binding.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation2/views/nested_navigation2_view.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation3/bindings/nested_navigation3_binding.dart';
import '../modules/navigation_demo/nested_navigation/modules/nested_navigation3/views/nested_navigation3_view.dart';
import '../modules/navigation_demo/nested_navigation/views/nested_navigation_view.dart';
import '../modules/navigation_demo/views/navigation_demo_view.dart';
import '../modules/state_manager_demo/bindings/state_manager_demo_binding.dart';
import '../modules/state_manager_demo/modules/anti_shake/bindings/anti_shake_binding.dart';
import '../modules/state_manager_demo/modules/anti_shake/views/anti_shake_view.dart';
import '../modules/state_manager_demo/modules/bindings_demo/bindings/bindings_demo_binding.dart';
import '../modules/state_manager_demo/modules/bindings_demo/views/bindings_demo_view.dart';
import '../modules/state_manager_demo/modules/dependency_injection/bindings/dependency_injection_binding.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_lazy_put_page1/bindings/get_lazy_put_page1_binding.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_lazy_put_page1/views/get_lazy_put_page1_view.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_lazy_put_page2/bindings/get_lazy_put_page2_binding.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_lazy_put_page2/views/get_lazy_put_page2_view.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_put_page1/bindings/get_put_page1_binding.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_put_page1/views/get_put_page1_view.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_put_page2/bindings/get_put_page2_binding.dart';
import '../modules/state_manager_demo/modules/dependency_injection/modules/get_put_page2/views/get_put_page2_view.dart';
import '../modules/state_manager_demo/modules/dependency_injection/views/dependency_injection_view.dart';
import '../modules/state_manager_demo/modules/getx_service_demo/bindings/getx_service_demo_binding.dart';
import '../modules/state_manager_demo/modules/getx_service_demo/views/getx_service_demo_view.dart';
import '../modules/state_manager_demo/modules/obx_demo/bindings/obx_demo_binding.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun1/bindings/obx_fun1_binding.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun1/views/obx_fun1_view.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun2/bindings/obx_fun2_binding.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun2/views/obx_fun2_view.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun3/bindings/obx_fun3_binding.dart';
import '../modules/state_manager_demo/modules/obx_demo/modules/obx_fun3/views/obx_fun3_view.dart';
import '../modules/state_manager_demo/modules/obx_demo/views/obx_demo_view.dart';
import '../modules/state_manager_demo/modules/response_listener/bindings/response_listener_binding.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response1/bindings/fun_response1_binding.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response1/views/fun_response1_view.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response2/bindings/fun_response2_binding.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response2/views/fun_response2_view.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response3/bindings/fun_response3_binding.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response3/views/fun_response3_view.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response4/bindings/fun_response4_binding.dart';
import '../modules/state_manager_demo/modules/response_listener/modules/fun_response4/views/fun_response4_view.dart';
import '../modules/state_manager_demo/modules/response_listener/views/response_listener_view.dart';
import '../modules/state_manager_demo/views/state_manager_demo_view.dart';
import '../modules/weichat_post/bindings/weichat_post_binding.dart';
import '../modules/weichat_post/modules/post/bindings/post_binding.dart';
import '../modules/weichat_post/modules/post/views/post_view.dart';
import '../modules/weichat_post/modules/timeline/bindings/timeline_binding.dart';
import '../modules/weichat_post/modules/timeline/views/timeline_view.dart';
import '../modules/weichat_post/views/weichat_post_view.dart';
import 'middleware/route_auth.dart';

part 'app_routes.dart';

class AppPages {
  AppPages._();

  // 初始化
  static const INITIAL = Routes.INDEX;

  static GetPage UN_KNOW = GetPage(
    name: _Paths.NOT_FOUND,
    page: () => const NotFoundView(),
    binding: NotFoundBinding(),
  );

  static final routes = [
    GetPage(
      name: _Paths.INDEX,
      page: () => const IndexView(),
      binding: IndexBinding(), // binding 主要用来做依赖注入（注入controller），或初始化等工作
    ),
    GetPage(
      name: _Paths.NAVIGATION_DEMO,
      page: () => const NavigationDemoView(),
      binding: NavigationDemoBinding(),
      // transition: Transition.cupertinoDialog,
      // transition: Transition.rightToLeft,
      children: [
        GetPage(
          name: _Paths.NAVIGATION1,
          page: () => const Navigation1View(),
          binding: Navigation1Binding(),
        ),
        GetPage(
          name: _Paths.NAVIGATION2,
          page: () => const Navigation2View(),
          binding: Navigation2Binding(),
        ),
        GetPage(
          name: _Paths.NAVIGATION2_1,
          page: () => const Navigation2View(),
          binding: Navigation2Binding(),
        ),
        // GetPage(
        //   name: _Paths.NOT_FOUND,
        //   page: () => const NotFoundView(),
        //   binding: NotFoundBinding(),
        // ),
        GetPage(
            name: _Paths.TEST_MIDDLE_WARE,
            page: () => const TestMiddleWareView(),
            binding: TestMiddleWareBinding(),
            middlewares: [
              RouteAuthMiddleware(),
            ]),
        GetPage(
          name: _Paths.TEST_MIDDLE_WARE1,
          page: () => const TestMiddleWare1View(),
          binding: TestMiddleWare1Binding(),
        ),
        GetPage(
          name: _Paths.NESTED_NAVIGATION,
          page: () => const NestedNavigationView(),
          binding: NestedNavigationBinding(),
          // children: [
          //   GetPage(
          //     name: _Paths.NESTED_NAVIGATION1,
          //     page: () => const NestedNavigation1View(),
          //     binding: NestedNavigation1Binding(),
          //   ),
          //   GetPage(
          //     name: _Paths.NESTED_NAVIGATION2,
          //     page: () => const NestedNavigation2View(),
          //     binding: NestedNavigation2Binding(),
          //   ),
          //   GetPage(
          //     name: _Paths.NESTED_NAVIGATION3,
          //     page: () => const NestedNavigation3View(),
          //     binding: NestedNavigation3Binding(),
          //   ),
          // ],
        ),
      ],
    ),
    GetPage(
      name: _Paths.LANGUAGE_DEMO,
      page: () => const LanguageDemoView(),
      binding: LanguageDemoBinding(),
    ),
    GetPage(
      name: _Paths.COMPOSE_DEMO,
      page: () => const ComposeDemoView(),
      binding: ComposeDemoBinding(),
      children: [
        GetPage(
          name: _Paths.SNACKBAR_DEMO,
          page: () => SnackbarDemoView(),
          binding: SnackbarDemoBinding(),
        ),
        GetPage(
          name: _Paths.DIALOG_DEMO,
          page: () => DialogDemoView(),
          binding: DialogDemoBinding(),
        ),
        GetPage(
          name: _Paths.BOTTOM_SHEET_DEMO,
          page: () => const BottomSheetDemoView(),
          binding: BottomSheetDemoBinding(),
        ),
      ],
    ),
    GetPage(
      name: _Paths.STATE_MANAGER_DEMO,
      page: () => const StateManagerDemoView(),
      binding: StateManagerDemoBinding(),
      children: [
        GetPage(
          name: _Paths.OBX_DEMO,
          page: () => const ObxDemoView(),
          binding: ObxDemoBinding(),
          children: [
            GetPage(
              name: _Paths.OBX_FUN1,
              page: () => const ObxFun1View(),
              binding: ObxFun1Binding(),
            ),
            GetPage(
              name: _Paths.OBX_FUN2,
              page: () => const ObxFun2View(),
              binding: ObxFun2Binding(),
            ),
            GetPage(
              name: _Paths.OBX_FUN3,
              page: () => const ObxFun3View(),
              binding: ObxFun3Binding(),
            ),
          ],
        ),
        GetPage(
          name: _Paths.RESPONSE_LISTENER,
          page: () => const ResponseListenerView(),
          binding: ResponseListenerBinding(),
          children: [
            GetPage(
              name: _Paths.FUN_RESPONSE1,
              page: () => const FunResponse1View(),
              binding: FunResponse1Binding(),
            ),
            GetPage(
              name: _Paths.FUN_RESPONSE2,
              page: () => const FunResponse2View(),
              binding: FunResponse2Binding(),
            ),
            GetPage(
              name: _Paths.FUN_RESPONSE3,
              page: () => const FunResponse3View(),
              binding: FunResponse3Binding(),
            ),
            GetPage(
              name: _Paths.FUN_RESPONSE4,
              page: () => const FunResponse4View(),
              binding: FunResponse4Binding(),
            ),
          ],
        ),
        GetPage(
          name: _Paths.ANTI_SHAKE,
          page: () => const AntiShakeView(),
          binding: AntiShakeBinding(),
        ),
        GetPage(
          name: _Paths.DEPENDENCY_INJECTION,
          page: () => const DependencyInjectionView(),
          binding: DependencyInjectionBinding(),
          children: [
            GetPage(
              name: _Paths.GET_PUT_PAGE1,
              page: () => GetPutPage1View(),
              // binding: GetPutPage1Binding(),
            ),
            GetPage(
              name: _Paths.GET_PUT_PAGE2,
              page: () => GetPutPage2View(),
              // binding: GetPutPage2Binding(),
            ),
            GetPage(
              name: _Paths.GET_LAZY_PUT_PAGE1,
              page: () => const GetLazyPutPage1View(),
              binding: GetLazyPutPage1Binding(),
            ),
            GetPage(
              name: _Paths.GET_LAZY_PUT_PAGE2,
              page: () => const GetLazyPutPage2View(),
              binding: GetLazyPutPage2Binding(),
            ),
          ],
        ),
        GetPage(
          name: _Paths.GETX_SERVICE_DEMO,
          page: () => const GetxServiceDemoView(),
          binding: GetxServiceDemoBinding(),
        ),
        GetPage(
          name: _Paths.BINDINGS_DEMO,
          page: () => BindingsDemoView(),
          // binding: BindingsDemoBinding(), // 这里放到 runApp 那里去初始化，试验统一进行绑定，不需要每个页面都绑定
        ),
      ],
    ),
    GetPage(
      name: _Paths.GETX_CONTROLLER_DEMO,
      page: () => const GetxControllerDemoView(),
      binding: GetxControllerDemoBinding(),
      children: [
        GetPage(
          name: _Paths.GETX_CONTROLLER_PAGE,
          page: () => const GetxControllerPageView(),
          binding: GetxControllerPageBinding(),
        ),
        GetPage(
          name: _Paths.SUPER_CONTROLLER_PAGE,
          page: () => const SuperControllerPageView(),
          binding: SuperControllerPageBinding(),
        ),
        GetPage(
          name: _Paths.GETCONNECT_PAGE,
          page: () => const GetconnectPageView(),
          binding: GetconnectPageBinding(),
        ),
        GetPage(
          name: _Paths.STATEMIXIN_PAGE,
          page: () => const StatemixinPageView(),
          binding: StatemixinPageBinding(),
        ),
      ],
    ),
    GetPage(
      name: _Paths.GET_UTILS_DEMO,
      page: () => GetUtilsDemoView(),
      binding: GetUtilsDemoBinding(),
    ),
    GetPage(
      name: _Paths.GET_VIEW_AND_GET_WIDGET,
      page: () => const GetViewAndGetWidgetView(),
      binding: GetViewAndGetWidgetBinding(),
      children: [
        GetPage(
          name: _Paths.GETX_VIEW_PAGE,
          page: () => const GetxViewPageView(),
          binding: GetxViewPageBinding(),
        ),
        GetPage(
          name: _Paths.GETX_WIDGET_PAGE,
          page: () => const GetxWidgetPageView(),
          binding: GetxWidgetPageBinding(),
        ),
      ],
    ),
    GetPage(
      name: _Paths.DEEP_LINK_DEMO,
      page: () => const DeepLinkDemoView(),
      binding: DeepLinkDemoBinding(),
    ),
    GetPage(
      name: _Paths.WEICHAT_POST,
      page: () => const WeichatPostView(),
      binding: WeichatPostBinding(),
      children: [
        GetPage(
          name: _Paths.POST,
          page: () => PostEditPage(),
          binding: PostBinding(),
        ),
        GetPage(
          name: _Paths.TIMELINE,
          page: () =>  TimelineView(),
          binding: TimelineBinding(),
        ),
      ],
    ),
  ];
}
